<?php
require_once 'config.php';
/* 
 * basic interface to the mysql database
 * Benjamin APPERT for Philips Medical Systems
 */
 
 $dbName = $GLOBALS['databaseName'];
 $dbUser = $GLOBALS['databaseUser'];
 $dbPass = $GLOBALS['databasePass'];
 $dbServer = $GLOBALS['databaseAddress'].':'.$GLOBALS['databasePort'];
 
 $socket = mysql_connect($dbServer,$dbUser,$dbPass);
 mysql_select_db($dbName,$socket);
 
 function query($query) 
 {
 	$result=mysql_query($query,$GLOBALS['socket']) or die(mysql_error());
 	return $result;
 }
 function insert($query) 
 {
 	$result=mysql_query($query,$GLOBALS['socket']) or die(mysql_error());
 	return mysql_insert_id($GLOBALS['socket']);
 }
 function update($query) 
 {
 	$result=mysql_query($query,$GLOBALS['socket']) or die(mysql_error());
 	return 0;
 }
 function delete($query) 
 {
 	$result=mysql_query($query,$GLOBALS['socket']) or die(mysql_error());
 	return 0;
 }

?>
